<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let url = "http://i.mooc.chaoxing.com/space/index?name=web-front&age=21";

        function parseUrl(url) {
            let res = {};
            let start = url.indexOf("?");
            let content = url.substring(start + 1);
            let arr = content.split('&');
            res.name = arr[0].split('=')[1];
            res.age = arr[1].split('=')[1];
            return res;
        }

        console.log(parseUrl(url));
    </script>

</body>

</html>